package br.com.jm.scwcd.obj1;

import java.io.IOException;
import java.util.Date;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class LifecycleServlet
 */
public class LifecycleServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	static {
		System.out.println("Servlet Class Loader at: "+ new Date());
	}
	
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public LifecycleServlet() {
        super();
        System.out.println("Servlet Class Instantiated at: "+ new Date());
    }
    
    @Override
    public void init(ServletConfig config) throws ServletException {
    	super.init(config);
    	System.out.println("Servlet INIT METHOD CALLED at: " + new Date());
    }
    
    @Override
    public void service(ServletRequest arg0, ServletResponse arg1)
    		throws ServletException, IOException {
    	System.out.println("Servlet SERVICE METHOD CALLED at: " + new Date());
    	super.service(arg0, arg1);
    }
    
    @Override
    protected void service(HttpServletRequest arg0, HttpServletResponse arg1)
    		throws ServletException, IOException {
    	System.out.println("Servlet HTTP SERVICE METHOD CALLED at: " + new Date());
    	super.service(arg0, arg1);
    }
    
    @Override
    public void destroy() {
    	System.out.println("Servlet DESTROY METHOD CALLED at: " + new Date());
    	super.destroy();
    }
    

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("Servlet DO GET METHOD CALLED at: " + new Date());
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
